{% extends 'user/center_base.html' %}
{% block info %}
<div class="tab-pane fade in active" id="profile">
    <h2>个人资料</h2>
    <form action="" method="post" enctype="multipart/form-data">
        {% csrf_token %}
        <div>
            {{ forms.head.label_tag }}
            <div class="user_head">
                <div class="user_head_up">{{ forms.head }}</div>
                <img src="/media/{{ request.user.head }}">
            </div>
        </div>
        <div class="form-group">
            {{ forms.username.label_tag }}
            {{ forms.username }}
        </div>

        <div class="form-group">
            {{ forms.phone.label_tag }}
            {{ forms.phone }}
        </div>
        <div class="form-group">
            {{ forms.email.label_tag }}
            {{ forms.email }}
        </div>
        <div class="form-group">
            {{ forms.last_name.label_tag }}
            {{ forms.last_name }}
        </div>
        <div class="form-group">
            {{ forms.first_name.label_tag }}
            {{ forms.first_name }}
        </div>
        <div class="form-group">
            {{ forms.last_login.label_tag }}
            {{ forms.last_login }}
        </div>
        <div class="form-group">
            {{ forms.date_joined.label_tag }}
            {{ forms.date_joined }}
        </div>

        {% if request.method == "POST" %}
        {% for fields in forms %}
        {% for error in fields.errors %}
        {% if error %}
        <p class="text-danger"> {{ error }} </p>
        {% endif %}
        {% endfor %}
        {% endfor %}
        {% endif %}

        <button type="submit" class="btn btn-primary">确认修改</button>

    </form>
</div>
{% endblock %}